<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /**
         * Cookie
         */ 
        // document.cookie = 'name=tom'

        // var date = new Date()
        // date.setDate(date.getDate() + 7)
        // document.cookie = 'age=20;expires=' + date.toUTCString()

        // var data = document.cookie
        // console.log(data)


        /**
         * WebStorage
         */ 
        // localStorage.setItem('username', 'alice')
        // sessionStorage.setItem('sex', '女')


        // console.log(localStorage.getItem('username'))
        // console.log(sessionStorage.getItem('sex'))

        // localStorage.removeItem('aa')

        /**
         * 存储对象
         */ 
        // var user = {
        //     "id": 1001,
        //     "name": "alice",
        //     "age": 19
        // }
        // localStorage.setItem('user', JSON.stringify(user))

        var data = JSON.parse(localStorage.getItem('user'))
        console.log(typeof data)
        console.log(data)
    </script>
</head>
<body>
    
</body>
</html>